<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        var obj ={
            1001:false,
            1002:false,
            1003:false
        }
        var id = 1001
        for(var key in obj){
            if(key == id){
                obj[id] = true;
            }else{
                obj[key] = false
            }
        }
        console.log(obj)
    </script>
</body>
</html>